/*txBx9FIYfUQl2UukqRyP73+PxnwFNg9cG2D09QQ88Ef4PaPs4BTnj4ZfDFTpSXII*/

import { ajax } from 'nc-lightapp-front';
import { URL, UISTATE, AREA, MODAL_ID, FIELD, COMMON } from '../../constance';
import { showResumeModal } from 'scmpub/scmpub/components/ResumeModal';
import { toast } from "nc-lightapp-front"
import { getLangByResId } from '../../../../../scmpub/scmpub/pub/tool/multiLangUtil';
import {
	changeUrlParam,
	updateCacheData,
	addCacheData,
	rewriteTransferSrcBids,
	getDefData,
	setDefData
} from '../../../../../scmpub/scmpub/pub/cache';
import { showErrorInfo, showSuccessInfo } from '../../../../../scmpub/scmpub/pub/tool/messageUtil';
import btnController from '../viewControl/btnController';

export default function clickyfzyBtn(skipCodes, callback) {
	// let data = this.props.createMasterChildDataSimple(this.pageId, this.formId, this.tableId);
	// console.log(data);
	// let allCheckedData = this.props.editTable.getAllRows(moduleId, true);//选中数据
	//let rows = this.props.editTable.getCheckedRows(COMMON.moduleId);
	//this.props.cardTable.getCheckedRows(COMMON.moduleId);
	// data['skipCodes'] = skipCodes ? skipCodes : (skipCodes = new Array());
	// data.templetid = this.templetid_25;
	let body = this.props.table.getCheckedRows(this.tableId);
	console.log(body);


	let rows=body.map((row)=>{
		return row.data.values.pk_invoice.value;
	})

    let data={code:"0"}
	data.data=rows;
    if (rows.length == 0){
		toast({color:"info",content:"至少选择一行数据"})
		return ;
	}
	for (let i = 0; i < body.length; i++) {
		if(body[i].data.values.fbillstatus.value != 3){
			toast({color:"info",content:"序号【"+body[i].index+"】不是审批状态"})
			return ;
		}
	}
	//console.log('==================='+this.pageId+'='+this.formId+'='+ this.tableId);
	ajax({
		url: URL.yfzy,
		pageid: this.pageId,
		data: data,
		success: (res) => {
			if (res.success && res.data) {
				// 交互式异常处理
				if (res.data.code == '1') {
					toast({color:"danger",content:res.data.mes})
					return;
				}else if(res.data.code == '0'){
					toast({color:"success",content:res.data.mes})
					return;
				}else {
					toast({color:"danger",content:res.data})
					return;
				}
			}
		}
	});

	// const row={}
	// console.log(data);

	// console.log(body);
	//alert(body);

}

/*txBx9FIYfUQl2UukqRyP73+PxnwFNg9cG2D09QQ88Ef4PaPs4BTnj4ZfDFTpSXII*/
